<script>
    function myBrowser() {
        var userAgent = navigator.userAgent;
        var isOpera = userAgent.indexOf('Opera') > -1;
        if (userAgent.indexOf('compatible') > -1 && userAgent.indexOf('MSIE') > -1 && !isOpera) {
            alert('IE浏览器')
        }
        if (userAgent.indexOf('Firefox') > -1) {
            alert('Firefox浏览器')
        }
        if (userAgent.indexOf('Chrome') > -1) {
            alert('Chrome浏览器')
        }
        if ((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))) {

            alert("mobile")
        } else {

            alert("pc")
        }
        if (userAgent.indexOf('micromessenger') > -1) {
            alert('微信浏览器')
        } else {
            alert('不是微信浏览器')
        }

    }
    myBrowser()
</script>